package cc.czlee.cloud.user.service;

import cc.czlee.cloud.model.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;

/*
 * Create by Colbert on 2019-05-01
 *
 * Copyright (C) 2019 chuanzhigo@gmail.com.
 */
@RestController
@RequestMapping("/user")
public class UserService {

    private final Logger logger = LoggerFactory.getLogger(UserService.class);

    @PostMapping("/login")
    public boolean login(@RequestBody User user) {
        return "czlee".equals(user.getUsername())
                && "czlee123".equals(user.getPassword());
    }

    @GetMapping("/login")
    public String login(@RequestParam("count") int count) {
        logger.warn("user invoked " + count);
        return "user invoked";
    }
}
